﻿namespace Jim.OA.Service;

/// <summary>
/// 指定流程相关资源查询
/// </summary>
/// <remarks>查询某个流程相关资源</remarks>   
[ApiDescriptionSettings(ApplicationConst.GroupName)]
public  class OAWorkflowGetService : IDynamicApiController, ITransient
{
    private readonly OAClientFactory _oaClientFactory;
    public OAWorkflowGetService(OAClientFactory oaClientFactory)
    {
        _oaClientFactory = oaClientFactory;
    }


    /// <summary>
    /// 获取单个流程相关信息
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetWorkFlowOutput> GetWorkFlowList([FromQuery] OAGetWorkFlowInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// 获取流程图链接
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetRequestChartOutput> GetRequestFlowChart([FromQuery] OAGetRequestChartInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// 获取流程相关资源
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetRequestResourceOutput> GetRequestResources([FromQuery] OAGetRequestResourceInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// 获取流程流转数据
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetRequestOperatorInfoOutput> GetRequestOperatorInfo([FromQuery] OAGetRequestOperatorInfoInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// 获取流程流转数据
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetRequestLogOutput> GetRequestLog([FromQuery] OAGetRequestLogInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// 获取流程状态数据
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetRequestStatusOutput> GetRequestStatus([FromQuery] OAGetRequestStatusInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// 获取指定流程的签字意见
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [NonUnify]
    public async Task<OAGetWorkFlowRequestLogsOutput> GetWorkflowRequestLogs([FromQuery] OAGetWorkFlowRequestLogsInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }
}
